﻿using System;
using System.Threading;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;


namespace MonitorFileConvert
{
    public class Ffmpeg
    {
        /// <summary>
        /// 调用ffmpeg.exe执行相应操作
        /// </summary>
        /// <param name="stringPath">ffmpeg.exe所在路径（如:E:\ttt\ffmpeg.exe）</param>
        /// <param name="stringArguments">给ffmpeg.exe传递的参数</param>
        /// <returns></returns>
        public static bool CreateProcessForFFMpeg(string stringPath, string stringArguments, bool boolShowDosWindow)
        {
            if (!System.IO.File.Exists(stringPath))
                return false;

            ProcessStartInfo info3 = new ProcessStartInfo(stringPath);
            if (boolShowDosWindow)
                info3.WindowStyle = ProcessWindowStyle.Normal;
            else
                info3.WindowStyle = ProcessWindowStyle.Hidden;

            info3.Arguments = stringArguments;

            Process proc = new Process();
            proc = Process.Start(info3);

            proc.WaitForExit();

            proc.Close();

            return true;

        }
    }
}
